# coding=utf-8
import os
from apps import handlers
import sys

env = os.environ.get('PYTHON_ENV', 'dev')
if sys.platform == "linux":
    env = "online"

ProjectName = "admin"

version = 1.0

if env == "online":  # 线上版本
    settings = dict(
        debug=False,  # 设置debug启动方式
        login_url="/login",  # 重定向到登录页面
        handlers=handlers.urls,
        xscf_cookies=True,
        template_path=os.path.join(os.path.dirname(__file__), "templates"),
        static_path=os.path.join(os.path.dirname(__file__), "static"),
        AsyncHTTPClientMaxClients=100,
        compress_response=True,
        verification_key="487b27928a349481",
        ES_URL="http://elasticsearch:9200",
        online=True
    )

    MYSQL = {
        "host": "mariadb",
        "post": 3306,
        "database": "laravel",
        "user": "laravel",
        "password": "secret"
    }

else:  # 线下版本
    settings = dict(
        debug=False,  # 设置debug启动方式
        login_url="/login",  # 重定向到登录页面
        handlers=handlers.urls,
        xscf_cookies=True,
        template_path=os.path.join(os.path.dirname(__file__), "templates"),
        static_path=os.path.join(os.path.dirname(__file__), "static"),
        AsyncHTTPClientMaxClients=100,
        compress_response=True,
        verification_key="487b27928a349481",
        ES_URL="http://43.252.228.135:9200/",
        online=False
    )

    MYSQL = {
        "host": "43.252.228.135",
        "post": 3306,
        "database": "graph",
        "user": "graph",
        "password": "KXZmiEcthNbN4xme"
    }

status_message = {
    0: 'success',
    4000: "接口已废弃",
    4004: '参数错误',
    4006: '缺少必要参数',
    4007: '不是json格式',
    4008: "系统错误",
    4009: "查询失败请检查query格式",
    4010: "找不到该文档"
}
